local ffrt_defaults_cflags = {
	"-g",
    "-D_FORTIFY_SOURCE=2",
    "-O2",
    "-fPIC",
    "-Wno-unused-variable",
    "-Wno-unused-function",
    "-Wno-unused-value",
    "-Wno-unused-private-field",
    "-Wno-tautological-constant-out-of-range-compare",
    "-Wno-shadow",
    "-Wno-float-equal",
    "-Wno-unused-parameter",
    "-fno-common",
    "-DOHOS_STANDARD_SYSTEM",
    "-DTASKSTAT_LOG_ENABLE=0",
    "-DIDLE_WORKER_DESTRUCT",
    "-DUSE_OHOS_QOS",
    "-DFFRT_PTHREAD_ENABLE",
    "-DFFRT_OH_WATCHDOG_ENABLE",
    "-DQOS_WORKER_FRAME_RTG"
}

target("ffrt")
	set_kind("$(kind)")
	add_files(
		"core/entity.cpp",
		"core/task.cpp",
		"core/task_io.cpp",
		"core/version_ctx.cpp",
		"dfx/bbox/bbox.cpp",
		"dfx/bbox/fault_logger_fd_manager.cpp",
		"dfx/dump/dump.cpp",
		"dfx/log/ffrt_log.cpp",
		"dfx/sysevent/sysevent.cpp",
		"dfx/trace/ffrt_trace.cpp",
		"dfx/trace_record/ffrt_trace_record.cpp",
		"dfx/watchdog/watchdog_util.cpp",
		"dm/dependence_manager.cpp",
		"dm/sdependence_manager.cpp",
		"eu/co2_context.c",
		"eu/co_routine.cpp",
		"eu/co_routine_factory.cpp",
		"eu/cpu_monitor.cpp",
		"eu/cpu_worker.cpp",
		"eu/cpuworker_manager.cpp",
		"eu/execute_unit.cpp",
		"eu/loop.cpp",
		"eu/loop_api.cpp",
		"eu/osattr_manager.cpp",
		"eu/qos_convert.cpp",
		"eu/qos_interface.cpp",
		"eu/rtg_ioctl.cpp",
		"eu/rtg_perf_ctrl.cpp",
		"eu/scpu_monitor.cpp",
		"eu/scpuworker_manager.cpp",
		"eu/sexecute_unit.cpp",
		"eu/worker_manager.cpp",
		"eu/worker_thread.cpp",
		"ipc/ipc.cpp",
		"queue/base_queue.cpp",
		"queue/concurrent_queue.cpp",
		"queue/eventhandler_adapter_queue.cpp",
		"queue/eventhandler_interactive_queue.cpp",
		"queue/queue_api.cpp",
		"queue/queue_handler.cpp",
		"queue/queue_monitor.cpp",
		"queue/serial_queue.cpp",
		"sched/deadline.cpp",
		"sched/execute_ctx.cpp",
		"sched/frame_interval.cpp",
		"sched/interval.cpp",
		"sched/load_tracking.cpp",
		"sched/multi_workgroup.cpp",
		"sched/qos.cpp",
		"sched/sched_deadline.cpp",
		"sched/scheduler.cpp",
		"sched/task_manager.cpp",
		"sched/task_state.cpp",
		"sync/condition_variable.cpp",
		"sync/delayed_worker.cpp",
		"sync/io_poller.cpp",
		"sync/mutex.cpp",
		"sync/perf_counter.cpp",
		"sync/poller.cpp",
		"sync/poller_api.cpp",
		"sync/shared_mutex.cpp",
		"sync/sleep.cpp",
		"sync/sync.cpp",
		"sync/thread.cpp",
		"sync/timer_api.cpp",
		"sync/wait_queue.cpp",
		"tm/cpu_task.cpp",
		"tm/queue_task.cpp",
		"tm/scpu_task.cpp",
		"tm/task_factory.cpp",
		"util/graph_check.cpp",
		"util/init.cpp",
		"util/spmc_queue.cpp",
		"util/worker_monitor.cpp")

	add_includedirs(
		"$(projectdir)/interfaces/kits",
		"$(projectdir)/interfaces/inner_api",
		{public=true}
	)
	add_headerfiles(
		"$(projectdir)/interfaces/kits/*.h",
		"$(projectdir)/interfaces/inner_api/*.h"
	)
	add_headerfiles(
		"$(projectdir)/interfaces/kits/c/*.h",
		"$(projectdir)/interfaces/inner_api/c/*.h",
		{prefixdir = "c"}
	)
	add_headerfiles(
		"$(projectdir)/interfaces/kits/cpp/*.h",
		"$(projectdir)/interfaces/inner_api/cpp/*.h",
		{prefixdir = "cpp"}
	)
	add_cxflags(ffrt_defaults_cflags)

	add_includedirs(
		"./",
		"dfx/log",
		"dfx/trace",
		"dfx/trace_record",
		"sched"
	)
	set_languages("c++17")
	add_ldflags("-Wl,-z,nodelete")

	add_defines(
		"FFRT_LOG_LEVEL=3",
		"FFRT_BBOX_ENABLE",
		"FFRT_OH_EVENT_RECORD",
		"FFRT_CO_BACKTRACE_OH_ENABLE",
		"FFRT_OH_TRACE_ENABLE",
		"FFRT_TRACE_LEVEL=1",
		"QOS_FRAME_RTG",
		"FFRT_TRACE_RECORD_LEVEL=1",
		"FFRT_SEND_EVENT"
	)

	-- add_defines(
	-- 	"FFRT_TASK_LOCAL_ENABLE",
	-- 	"FFRT_HITRACE_ENABLE"
	-- )

	add_defines("FFRT_ASYNC_STACKTRACE")
	add_files("dfx/async_stack/ffrt_async_stack.cpp")

	add_packages(
		"boundscheck",
		"c_utils",
		"faultloggerd",
		"hilog",
		"sysevent"
	)
